<template>
	<view class="userCenter">
		<!-- 账户信息 -->
		<view class="account-info">
			<view class="cur-title">
				<image src="https://img.quanminyanxuan.com/other/9017e0c89b0f43fcb1d14a7c89703beb.png" mode="widthFix"></image>
				<view class="hdgz" @click="clickRule">
					<uni-icons type="info" size="12" color="#FFD8DB" style="margin-right:2px;"></uni-icons>
					活动规则
				</view>
			</view>
			<view class="jifen" @click="goHome">
				<image src="https://img.quanminyanxuan.com/other/c9884cc5222d4dca880ac4aa8bf97433.png" mode="widthFix"></image>
				<text>{{redPack}}</text>
				<uni-icons type="forward" size="12" color="#FFD8DB" style="margin-right:2px;"></uni-icons>
			</view>
			<view class="tips sm-font" @click="goHome">
				您已获得{{redPack}}积分奖励
			</view>
		</view>
		<!-- 积分兑换 -->
		<view class="adver" @click="goHome">
			<view class="product-box">
				<view class="title-box">
					<view class="title">
						兑换商城
					</view>
					<view class="subtit">
						积分当钱花·好礼兑不停
					</view>
					<view class="btn">
						立即兑换
						<uni-icons type="forward" size="11" color="#FFD8DB"></uni-icons>
					</view>
				</view>
				<view class="product">
					<image src="https://img.quanminyanxuan.com/other/0c90261de0784773b7b3eba195d10a64.jpg" mode="widthFix"></image>
				</view>
				<view class="product">
					<image src="https://img.quanminyanxuan.com/other/34ec23a48ab842edb2ce025235f70a82.jpg" mode="widthFix"></image>
				</view>
			</view>
			<view class="tips">
				<uni-notice-bar showIcon scrollable single color="#959595" :speed="50" background-color="rgba(255, 255, 255, 0)" size="11">
					<view>您有<text style='color:#FF162E;font-weight: bold;'>{{redPack}}</text>积分即将过期，为避免失效，请尽快使用。</view>
				</uni-notice-bar>
			</view>
		</view>
		
		<order-status></order-status>
		<view class="my-order product">
			<view class="title-box">
				<view class="title">
					热门兑换
				</view>
				<view class="more" @click="goHome">
					更多推荐
					<uni-icons type="forward" size="12" color="#333" style="margin-right:2px;"></uni-icons>
				</view>
			</view>
			<view class="order-status">
				<view class="grid-item-box">
					<image src="https://img.quanminyanxuan.com/other/f41c007f65fe48269eb8d876a0e67a57.jpg" mode="widthFix"></image>
				</view>
				<view class="grid-item-box">
					<image src="https://img.quanminyanxuan.com/other/f41c007f65fe48269eb8d876a0e67a57.jpg" mode="widthFix"></image>
				</view>
				<view class="grid-item-box">
					<image src="https://img.quanminyanxuan.com/other/f41c007f65fe48269eb8d876a0e67a57.jpg" mode="widthFix"></image>
				</view>
				<view class="grid-item-box">
					<image src="https://img.quanminyanxuan.com/other/f41c007f65fe48269eb8d876a0e67a57.jpg" mode="widthFix"></image>
				</view>
			</view>
		</view>
		<rule ref="rule"></rule>
		<list ref="list"></list>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				rule:false
			}
		},
		computed:{
			redPack(){
				return this.$store.state.redPack
			}
		},
		onReachBottom(){
			this.$refs.list.reachBottom();
		},
		methods: {
			clickRule(){
				this.$refs.rule.open();
			},
			goHome(){
				this.$uniGo('switchTab',{
					url:"/pages/home/home"
				})
				// uni.switchTab({
				// 	url:"/pages/home/home"
				// })
			}			
		}
	}
</script>

<style lang="scss" scoped>
	.userCenter{
		background: url(https://img.quanminyanxuan.com/other/10b5094606b142e39a4210acb6de017b.png) no-repeat;
		background-size: 100% auto;
	}
	.account-info{
		padding: 40rpx 20rpx;
		color: #FFD8DB;
		.cur-title{
			display: flex;
			justify-content: space-between;
			align-items: center;			
			margin-bottom: 50rpx;
			image{
				width: 38%;
			}
			.hdgz{
				display: flex;
				align-items: center;
			}
		}
		.sm-font{
			font-size: $uni-font-size-sm;
		}
		.jifen{
			display: flex;
			align-items: center;
			position: relative;
			padding-left: 30rpx;			
			text{
				font-size: 50rpx;
				font-weight: bold;
				margin-right: 10rpx;
				color: #fff;
			}
			image{				
				width: 25rpx;
				height: 25rpx;
				position: absolute;
				bottom: 10rpx;
				left: 0;
			}
		}
	}
	.adver{
		width: 95vw;
		margin: 0 auto;
		border-radius: 20rpx;
		padding: 20rpx;
		background: rgba(255, 255, 255, .7);
		box-shadow: 0 -2px 8px 0 rgba(0, 0, 0, .1);
		box-sizing: border-box;
		.product-box{
			display: flex;
			align-items: center;
			justify-content: space-between;
			.title-box{
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;
				.title{
					font-weight: bold;
					font-size: 35rpx;
					margin-bottom: 10rpx;
				}
				.subtit{
					font-size: $uni-font-size-sm;
					color: $theme-color;
					margin-bottom: 30rpx;
				}
				.btn{
					display: flex;
					align-items: center;
					padding: 10rpx 30rpx;
					background:  $theme-color;
					color: #fff;
					border-radius: 30rpx;
				}
			}
			.product{
				width: 180rpx;
				height: 180rpx;
				border-radius: 10rpx;
				overflow: hidden;
				image{
					width: 100%;
					height: 100%;
				}
			}
		}
		.tips{
			padding-top: 15rpx;
			border-top: 1rpx #fff solid;
			margin-top: 30rpx;
		}
	}
	.my-order{
		width: 95vw;
		margin: 20rpx auto;
		border-radius: 20rpx;
		padding: 20rpx;
		background: rgba(255, 255, 255, .7);
		box-shadow: 0 -2px 8px 0 rgba(0, 0, 0, .1);
		.title-box{
			padding: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			margin-bottom: 20rpx;
			.title{
				font-weight: bold;
				// font-size: $uni-font-size-lg;
			}
			.more{
				font-size: $uni-font-size-sm;
			}
		}
		.order-status{
			padding: 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
		}
		.grid-item-box{
			display: flex;
			align-items: center;
			flex-direction: column;
			justify-content: center;
			.text{
				font-size: $uni-font-size-sm;
			}
		}		
	}
	.product{
		.title-box{
			margin-bottom: 0;
		}
		.grid-item-box{
			image{
				width: 140rpx;
				height: 140rpx;
				border-radius: 10rpx;
			}
		}
	}
</style>
